package com.jxau.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jxau.dao.CinemaDao;
import com.jxau.domain.Cinema;
import com.jxau.service.CinemaService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class CinemaServiceImpl extends ServiceImpl<CinemaDao, Cinema> implements CinemaService {

    @Resource
    private CinemaDao cinemaDao;

    @Override
    public IPage<Cinema> getPage(int currentPage, int pageSize, Cinema cinema) {
        QueryWrapper<Cinema> qw = new QueryWrapper<Cinema>();
        if(!cinema.getCinemaname().equals("")){
            qw.eq("cinemaname", cinema.getCinemaname());
        }
        IPage<Cinema> page = new Page<>(currentPage, pageSize);
        cinemaDao.selectPage(page, qw);
        return page;
    }
}
